<template>
  <div>
    <p>ES8的async-await</p>
    <input type="text" v-model="phone" />
    <input type="text" v-model="code" />
    <input type="text" v-model="username" />
    <input type="text" v-model="password" />
    <button @click="reg">注册</button>
  </div>
</template>

<script>
import { playCategory, register } from "../apis";
export default {
  data() {
    return {
      phone: "18937366677",
      code: "r2b7",
      username: "tony",
      password: "123456",
    };
  },
  created() {
    this.getData();
  },
  methods: {
    async getData() {
      //   this.$http('http://localhost:3000/play/category')
      //     .then(res => {
      //         console.log(res);
      //     })
      let res = await playCategory();
      console.log(444, res);
    },
    async reg() {
      let res = await register({
        phone: this.phone,
        code: this.code,
        username: this.username,
        password: this.password,
      });
      console.log(666, res);
    },
  },
};
</script>

<style>
</style>